<?php
require('../../../public/connection.php');
require('../../../class/Mysql.php');
$data = (array)json_decode(file_get_contents("php://input", true));
if (empty($data["title"])||empty($data["content"])||empty($data["date"])||$data["type"]<0||$data["type"]>1) {
    die(json_encode(array("code" => 400, "msg" => "格式错误")));
}
$edit_one_data = new Mysql();
$result = $edit_one_data->addOrEditData(
    "update dailypaper set type={$data["type"]},date='{$data["date"]}',title='{$data["title"]}',content='{$data["content"]}' where id={$data["id"]};"
);
die(json_encode($result));